﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace System.Xml.Serialization.TestProject
{

    class TestHelper
    {
        internal static void TestRead<T, I>(string input, Predicate<T> propertyReader)
            where T : new()
        {
            T item = new T();
            XmlObjectSerializer.Load<I>(input, item);
            Assert.IsTrue(propertyReader(item));
        }

        internal static void TestWrite<T, I>(Action<T> propertyWriter, string output)
            where T : new()
        {
            T item = new T();
            propertyWriter(item);
            Assert.AreEqual(XmlObjectSerializer.Save<I>(item), output);
        }
    }

    /// <summary>
    ///This is a test class for XmlObjectSerializerTest and is intended
    ///to contain all XmlObjectSerializerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class XmlObjectSerializerTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for basic Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_Person()
        {
            TestSuite_NoInheritance.TestClass_Person();
        }

        /// <summary>
        ///A test for basic Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IPersonClass()
        {
            TestSuite_NoInheritance.TestClass_IPersonClass();
        }

        /// <summary>
        ///A test for basic Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IPersonCustomClass()
        {
            TestSuite_NoInheritance.TestClass_IPersonCustomClass();
        }

        /// <summary>
        ///A test for basic Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IPersonAttributeClass()
        {
            TestSuite_NoInheritance.TestClass_IPersonAttributeClass();
        }

        /// <summary>
        ///A test for basic Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IPersonCustomAttributeClass()
        {
            TestSuite_NoInheritance.TestClass_IPersonCustomAttributeClass();
        }

        /// <summary>
        ///A test for basic Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IPersonElementClass()
        {
            TestSuite_NoInheritance.TestClass_IPersonElementClass();
        }

        /// <summary>
        ///A test for basic Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IPersonCustomElementClass()
        {
            TestSuite_NoInheritance.TestClass_IPersonCustomElementClass();
        }

        /// <summary>
        ///A test for advanced Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_VeryImportantPerson()
        {
            TestSuite_ClassInheritance.TestClass_VeryImportantPerson();
        }

        /// <summary>
        ///A test for advanced Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_VeryImportantPerson_Compatibility()
        {
            TestSuite_ClassInheritance.TestClass_VeryImportantPerson_Compatibility();
        }

        /// <summary>
        ///A test for advanced Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IVeryImportantPersonClass()
        {
            TestSuite_ClassInheritance.TestClass_IVeryImportantPersonClass();
        }

        /// <summary>
        ///A test for advanced Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IVeryImportantPersonClass_Compatibility()
        {
            TestSuite_ClassInheritance.TestClass_IVeryImportantPersonClass_Compatibility();
        }

        /// <summary>
        ///A test for advanced Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IVeryImportantPersonChildClass()
        {
            TestSuite_ClassInheritance.TestClass_IVeryImportantPersonChildClass();
        }

        /// <summary>
        ///A test for advanced Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IVeryImportantPersonChildClass_Compatibility()
        {
            TestSuite_ClassInheritance.TestClass_IVeryImportantPersonChildClass_Compatibility();
        }

        /// <summary>
        ///A test for advanced Seralization
        ///</summary>
        [TestMethod()]
        public void TestClass_IVeryImportantPersonColor()
        {
            TestSuite_ClassInheritance.TestClass_IVeryImportantPersonColor();
        }
    }
}
